#ifndef __CACHE_H__
#define __CACHE_H__
#include "simdatatypes.h"
#include "config.h"
#include "trace.h"
#include "simdatatypes.h"
#include <stdlib.h>
#include <stdio.h>

//#define TRACEPRINT
#ifdef TRACEPRINT
#define PRINT printf
#else
#define PRINT(format, args...) ((void)0)
#endif

#define CACHEPRINT
#ifdef CACHEPRINT
#define CPRINT fprintf
#else
#define CPRINT(format, args...) ((void)0)
#endif
#define WORD_SIZE 32

typedef enum{
	L1I=0,
	L1D,
	L2,
	CACHELEVELMAX
}cacheLevel;

typedef enum{
	DIRTY=-1,
	CLEAN=0,
	NOKICK=1
}kickoutType;

typedef struct
{
	kickoutType type;
	uint32 evictedAddress;
}kickout;

typedef void* cachePointer;

typedef struct{
	cacheLevel level;
	cachePointer cacheptr;
}cache_s;

/*Wrapper functions for Caches*/
boolean checkCache(cache_s* cache, uint32 reference, opcode isWrite, results_s* results);
kickout addValueToCache(cache_s* cache, uint32 reference, opcode isWrite, results_s* results);
boolean deleteCache(cache_s* cache);
boolean createCache(cache_s* cache);
void printCache(cache_s* cache);
boolean initCaches();
boolean deleteCaches();

#endif/*CACHE_H*/
